package com.ms.tank;


import com.ms.tank.common.PropertyMgr;
import com.ms.tank.enums.Dir;
import com.ms.tank.enums.Group;
import com.ms.tank.game.Tank;
import com.ms.tank.game.TankFrame;

/**
 * @Date 2021/2/28 19:35:34
 * @Author mashuai
 */
public class TankRun {

    public static void main(String[] args) throws InterruptedException {
        TankFrame tankFrame = new TankFrame();

        //读取配置文件
        int initTankCount =Integer.parseInt(PropertyMgr.get("initTankCount").toString()) ;

        //初始化敌方坦克
        for (int i = 0; i < initTankCount; i++) {
            tankFrame.tanks.add(tankFrame.gameFactory.createTank(50 + i*80,200, Dir.DOWN, Group.BAD,tankFrame));
        }

        //背景音乐
        //new Thread(()->new Audio("audio/war1.wav").loop()).start();

        //主线程每隔25ms刷新页面
        while (true){
            Thread.sleep(25);
            tankFrame.repaint();
        }
    }

}
